# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=shairport-sync
pkgver=4.3.4
pkgrel=0
pkgdesc="AirTunes emulator. Shairport Sync adds multi-room capability with Audio Synchronisation"
url="https://github.com/mikebrady/shairport-sync"
arch="all"
license="custom"
depends="avahi"
makedepends="
	alsa-lib-dev
	autoconf
	automake
	avahi-dev
	libconfig-dev
	libtool
	openssl-dev>3
	pipewire-dev
	popt-dev
	pulseaudio-dev
	soxr-dev
	xmltoman
	"
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/mikebrady/shairport-sync/archive/$pkgver.tar.gz
	$pkgname.initd
	"
options="!check"

prepare() {
	default_prepare
	autoreconf -i -f
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--with-piddir=/run \
		--with-alsa \
		--with-pa \
		--with-pw \
		--with-avahi \
		--with-ssl=openssl \
		--with-soxr \
		--with-stdout \
		--with-pipe \
		--with-metadata \
		--with-mpris-interface \
		--with-dbus-interface
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
eaa279544689a4651b8fd7c54e1f7cc09d505a50319e678cda55d5ce1df6cbfb0afef5f6ebf5c26d5abd67669b7b163a5149707fdd36a4460eb8b60375e5984d  shairport-sync-4.3.4.tar.gz
aeead51ef0f17d360bb1e2d2ae897974ef507ef56db84e6aeb79d8ec522c3bb9336f01ff4150e70fecfebf9808dd7190cb2839e287cf0ef6e1886504c1f1edc6  shairport-sync.initd
"
